package DataStructure.Tree.binaryTree;

/**
 * @Author: Dijah
 * @Date: 2023/8/8 19:41
 * @Desc:
 */
public class BinaryTreeDemo {

    public static void main(String[] args) {
        BinaryTree bt = new BinaryTree();

        //创建节点
        TreeModel root = new TreeModel(1,"lebron");
        TreeModel node1 = new TreeModel(2,"james");
        TreeModel node2 = new TreeModel(3,"jordon");
        TreeModel node3 = new TreeModel(4,"davis");
        TreeModel node4 = new TreeModel(5,"wade");
        TreeModel node5 = new TreeModel(6,"jr");
        TreeModel node6 = new TreeModel(7,"iversion");

        root.setLeft(node1);
        root.setRight(node2);

        node1.setLeft(node3);
        node1.setRight(node4);

        node2.setLeft(node5);
        node2.setRight(node6);

        bt.setRoot(root);

        System.out.println("前序遍历：");
        bt.preOrder();

        System.out.println("中序遍历");
        bt.infixOrder();

        System.out.println("后续遍历");
        bt.postOrder();
    }
}
